﻿using ATM.Common;
using ATM.Entities;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ATM.DAO
{
    public class AuthenticateUserDAO
    {
        public static SqlConnection con;
        
        public static int UpdateCard(Card card)
        {
            SqlCommand cmd = new SqlCommand("Update Cards set Status=@Stt,AccountID=@Acc,PIN=@Pin,Attempt=@Attempt where CardNo=@CardNo", DataConnection.GetConnection());
            cmd.Parameters.AddWithValue("@Stt", card.Status);
            cmd.Parameters.AddWithValue("@Acc", card.AccID);
            cmd.Parameters.AddWithValue("@PIN", card.PIN);
            cmd.Parameters.AddWithValue("@Attempt", card.Attempt);
            cmd.Parameters.AddWithValue("@CardNo", card.CardNo);
            return cmd.ExecuteNonQuery();
        }
    }
}
